axios.defaults.baseURL = 'http://cba.itlike.com/public/index.php?s=/api/'

// 点击搜索按钮
document.querySelector('.button').addEventListener('click',async function () {
    const search = document.querySelector('[type="text"]').value
    if (search.trim() === '') return
    // console.log(search)
    const res = await axios.get('/goods/list', {
        params: {
            goodsName:search
        }
    })
    console.log(res)
    // 本地存储
    localStorage.setItem('goodsList', search)
    // 清空搜索框
    document.querySelector('[type="text"]').value = ''
    location.href = './goodslist.html'
})